# import sqlite3
#
# # 连接到数据库
# conn = sqlite3.connect("cloud_clip.db")
# cursor = conn.cursor()
#
# # 查询 Platforms 表
# cursor.execute("SELECT * FROM Platforms")
# platforms = cursor.fetchall()
# print("Platforms Table:")
# for platform in platforms:
#     print(platform)
#
# # 查询 Regions 表
# cursor.execute("SELECT * FROM Regions")
# regions = cursor.fetchall()
# print("\nRegions Table:")
# for region in regions:
#     print(region)
#
# # 查询 FanLevels 表
# cursor.execute("SELECT * FROM FanLevels")
# fan_levels = cursor.fetchall()
# print("\nFanLevels Table:")
# for fan_level in fan_levels:
#     print(fan_level)
#
# # 查询 PricingRules 表
# cursor.execute("SELECT * FROM PricingRules")
# pricing_rules = cursor.fetchall()
# print("\nPricingRules Table:")
# for pricing_rule in pricing_rules:
#     print(pricing_rule)
#
# # 关闭连接
# conn.close()



import sqlite3

# 连接到数据库
conn = sqlite3.connect("cloud_clip.db")
cursor = conn.cursor()

# 查询抖音云剪的平台ID
cursor.execute("SELECT id FROM Platforms WHERE name = '抖音云剪'")
platform_id = cursor.fetchone()

# 查询全国不限地区的regionID
cursor.execute("SELECT id FROM Regions WHERE name = '全国不限地区'")
region_id = cursor.fetchone()

# 查询3级粉丝等级的fan_level_id
cursor.execute("SELECT id FROM FanLevels WHERE name = '3级'")
fan_level_id = cursor.fetchone()

if platform_id and region_id and fan_level_id:
    platform_id = platform_id[0]
    region_id = region_id[0]
    fan_level_id = fan_level_id[0]

    # 查询抖音云剪在全国不限地区且粉丝等级为3级的价格规则
    cursor.execute("""
    SELECT
        min_price,
        max_price
    FROM
        PricingRules
    WHERE
        platform_id = ? AND
        region_id = ? AND
        fan_level_id = ?
    """, (platform_id, region_id, fan_level_id))

    pricing_rule = cursor.fetchone()
    if pricing_rule:
        min_price, max_price = pricing_rule
        print(f"抖音云剪在全国不限地区且粉丝等级为3级的价格范围: {min_price} 到 {max_price}")
    else:
        print("未找到相应的价格规则。")
else:
    print("未找到平台、地区或粉丝等级。")

# 关闭连接
conn.close()
